package com.roc.steelend.controller;


import com.roc.steelend.service.InvoiceDetailBuyService;
import com.roc.steelend.service.InvoiceDetailKaipingService;
import com.roc.steelend.service.InvoiceDetailSaleService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigInteger;
import java.util.HashMap;
import java.util.List;

@RestController
@CrossOrigin
@Api(tags = "开票细节功能接口")
public class InvoiceDetailController {


    @Autowired
    private InvoiceDetailBuyService invoiceDetailBuyService;
    @Autowired
    private InvoiceDetailSaleService invoiceDetailSaleService;
    @Autowired
    private InvoiceDetailKaipingService invoiceDetailKaipingService;

    /**
     * 采购查询开票细节
     *
     */
    @GetMapping("/v1/buy/detail/invoice")
    public List<HashMap<String,Object>> buyDetailByInvoice(@RequestParam BigInteger buyOrderId){

           return  invoiceDetailBuyService.buyDetailByInvoice(buyOrderId);
    }

    /**
     * 销售查询开票细节
     *
     */
    @GetMapping("/v1/sale/detail/invoice")
    public List<HashMap<String,Object>> saleDetailByInvoice(@RequestParam BigInteger saleOrderId){

        return  invoiceDetailSaleService.saleDetailByInvoice(saleOrderId);
    }

    /**
     * 开平查询开票细节
     *
     */
    @GetMapping("/v1/kaiping/detail/invoice")
    public List<HashMap<String,Object>> kaipingDetailByInvoice(@RequestParam BigInteger kaipingOrderId){

        return invoiceDetailKaipingService.kaipingDetailByInvoice(kaipingOrderId);
    }

}
